package com.chaosyeb.server.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @Description : 自定义资源映射
 * @Author : Chaos
 * @Date : 2022/3/2 10:02
 * @Version : 1.0
 **/
@Component
@Configuration
public class WebConfigurer extends WebMvcConfigurerAdapter {

    @Autowired
    UploadConfig uploadConfig;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        registry.addResourceHandler("/static/**")
                .addResourceLocations("file:///" + uploadConfig.getUploadPath());
    }
}
